import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/acquisition_entity.dart';
import 'package:wch/model/patient_list.dart';
import 'dart:async';

import 'package:wch/model/patient_label_list.dart';


PatientListModel $PatientListModelFromJson(Map<String, dynamic> json) {
  final PatientListModel patientListModel = PatientListModel();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    patientListModel.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    patientListModel.msg = msg;
  }
  final PatientListData? data = jsonConvert.convert<PatientListData>(
      json['data']);
  if (data != null) {
    patientListModel.data = data;
  }
  return patientListModel;
}

Map<String, dynamic> $PatientListModelToJson(PatientListModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data?.toJson();
  return data;
}

extension PatientListModelExtension on PatientListModel {
  PatientListModel copyWith({
    String? code,
    String? msg,
    PatientListData? data,
  }) {
    return PatientListModel()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

PatientListData $PatientListDataFromJson(Map<String, dynamic> json) {
  final PatientListData patientListData = PatientListData();
  final int? pageIndex = jsonConvert.convert<int>(json['pageIndex']);
  if (pageIndex != null) {
    patientListData.pageIndex = pageIndex;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    patientListData.pageSize = pageSize;
  }
  final int? totalPage = jsonConvert.convert<int>(json['totalPage']);
  if (totalPage != null) {
    patientListData.totalPage = totalPage;
  }
  final int? totalCount = jsonConvert.convert<int>(json['totalCount']);
  if (totalCount != null) {
    patientListData.totalCount = totalCount;
  }
  final List<PatientListDataData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<PatientListDataData>(e) as PatientListDataData)
      .toList();
  if (data != null) {
    patientListData.data = data;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    patientListData.total = total;
  }
  final int? current = jsonConvert.convert<int>(json['current']);
  if (current != null) {
    patientListData.current = current;
  }
  final dynamic records = json['records'];
  if (records != null) {
    patientListData.records = records;
  }
  final int? size = jsonConvert.convert<int>(json['size']);
  if (size != null) {
    patientListData.size = size;
  }
  final int? pages = jsonConvert.convert<int>(json['pages']);
  if (pages != null) {
    patientListData.pages = pages;
  }
  return patientListData;
}

Map<String, dynamic> $PatientListDataToJson(PatientListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['pageIndex'] = entity.pageIndex;
  data['pageSize'] = entity.pageSize;
  data['totalPage'] = entity.totalPage;
  data['totalCount'] = entity.totalCount;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  data['total'] = entity.total;
  data['current'] = entity.current;
  data['records'] = entity.records;
  data['size'] = entity.size;
  data['pages'] = entity.pages;
  return data;
}

extension PatientListDataExtension on PatientListData {
  PatientListData copyWith({
    int? pageIndex,
    int? pageSize,
    int? totalPage,
    int? totalCount,
    List<PatientListDataData>? data,
    int? total,
    int? current,
    dynamic records,
    int? size,
    int? pages,
  }) {
    return PatientListData()
      ..pageIndex = pageIndex ?? this.pageIndex
      ..pageSize = pageSize ?? this.pageSize
      ..totalPage = totalPage ?? this.totalPage
      ..totalCount = totalCount ?? this.totalCount
      ..data = data ?? this.data
      ..total = total ?? this.total
      ..current = current ?? this.current
      ..records = records ?? this.records
      ..size = size ?? this.size
      ..pages = pages ?? this.pages;
  }
}

PatientListDataData $PatientListDataDataFromJson(Map<String, dynamic> json) {
  final PatientListDataData patientListDataData = PatientListDataData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    patientListDataData.id = id;
  }
  final int? hospitalId = jsonConvert.convert<int>(json['hospitalId']);
  if (hospitalId != null) {
    patientListDataData.hospitalId = hospitalId;
  }
  final String? hospitalName = jsonConvert.convert<String>(
      json['hospitalName']);
  if (hospitalName != null) {
    patientListDataData.hospitalName = hospitalName;
  }
  final int? doctorId = jsonConvert.convert<int>(json['doctorId']);
  if (doctorId != null) {
    patientListDataData.doctorId = doctorId;
  }
  final String? templateId = jsonConvert.convert<String>(json['templateId']);
  if (templateId != null) {
    patientListDataData.templateId = templateId;
  }
  final String? templateName = jsonConvert.convert<String>(
      json['templateName']);
  if (templateName != null) {
    patientListDataData.templateName = templateName;
  }
  final String? deviceNumber = jsonConvert.convert<String>(
      json['deviceNumber']);
  if (deviceNumber != null) {
    patientListDataData.deviceNumber = deviceNumber;
  }
  final String? deviceBluetoothNumber = jsonConvert.convert<String>(
      json['deviceBluetoothNumber']);
  if (deviceBluetoothNumber != null) {
    patientListDataData.deviceBluetoothNumber = deviceBluetoothNumber;
  }
  final String? deviceId = jsonConvert.convert<String>(json['deviceId']);
  if (deviceId != null) {
    patientListDataData.deviceId = deviceId;
  }
  final String? doctorName = jsonConvert.convert<String>(json['doctorName']);
  if (doctorName != null) {
    patientListDataData.doctorName = doctorName;
  }
  final dynamic departmentId = json['departmentId'];
  if (departmentId != null) {
    patientListDataData.departmentId = departmentId;
  }
  final dynamic departmentName = json['departmentName'];
  if (departmentName != null) {
    patientListDataData.departmentName = departmentName;
  }
  final dynamic text = json['text'];
  if (text != null) {
    patientListDataData.text = text;
  }
  final List<PatientListDataDataList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<PatientListDataDataList>(
          e) as PatientListDataDataList)
      .toList();
  if (list != null) {
    patientListDataData.list = list;
  }
  final List<
      PatientLabelListShopLabelList>? shopLabelList = (json['shopLabelList'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<PatientLabelListShopLabelList>(
          e) as PatientLabelListShopLabelList).toList();
  if (shopLabelList != null) {
    patientListDataData.shopLabelList = shopLabelList;
  }
  final List<
      AcquisitionAcquisitionLabelList>? acquisitionLabelList = (json['acquisitionLabelList'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<AcquisitionAcquisitionLabelList>(
          e) as AcquisitionAcquisitionLabelList).toList();
  if (acquisitionLabelList != null) {
    patientListDataData.acquisitionLabelList = acquisitionLabelList;
  }
  final String? isDelete = jsonConvert.convert<String>(json['isDelete']);
  if (isDelete != null) {
    patientListDataData.isDelete = isDelete;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    patientListDataData.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    patientListDataData.updateTime = updateTime;
  }
  return patientListDataData;
}

Map<String, dynamic> $PatientListDataDataToJson(PatientListDataData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['hospitalId'] = entity.hospitalId;
  data['hospitalName'] = entity.hospitalName;
  data['doctorId'] = entity.doctorId;
  data['templateId'] = entity.templateId;
  data['templateName'] = entity.templateName;
  data['deviceNumber'] = entity.deviceNumber;
  data['deviceBluetoothNumber'] = entity.deviceBluetoothNumber;
  data['deviceId'] = entity.deviceId;
  data['doctorName'] = entity.doctorName;
  data['departmentId'] = entity.departmentId;
  data['departmentName'] = entity.departmentName;
  data['text'] = entity.text;
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['shopLabelList'] = entity.shopLabelList?.map((v) => v.toJson()).toList();
  data['acquisitionLabelList'] = entity.acquisitionLabelList?.map((v) => v.toJson()).toList();
  data['isDelete'] = entity.isDelete;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  return data;
}

extension PatientListDataDataExtension on PatientListDataData {
  PatientListDataData copyWith({
    String? id,
    int? hospitalId,
    String? hospitalName,
    int? doctorId,
    String? templateId,
    String? templateName,
    String? deviceNumber,
    String? deviceBluetoothNumber,
    String? deviceId,
    String? doctorName,
    dynamic departmentId,
    dynamic departmentName,
    dynamic text,
    List<PatientListDataDataList>? list,
    List<PatientLabelListShopLabelList>? shopLabelList,
    List<AcquisitionAcquisitionLabelList>? acquisitionLabelList,
    String? isDelete,
    String? createTime,
    String? updateTime,
  }) {
    return PatientListDataData()
      ..id = id ?? this.id
      ..hospitalId = hospitalId ?? this.hospitalId
      ..hospitalName = hospitalName ?? this.hospitalName
      ..doctorId = doctorId ?? this.doctorId
      ..templateId = templateId ?? this.templateId
      ..templateName = templateName ?? this.templateName
      ..deviceNumber = deviceNumber ?? this.deviceNumber
      ..deviceBluetoothNumber = deviceBluetoothNumber ??
          this.deviceBluetoothNumber
      ..deviceId = deviceId ?? this.deviceId
      ..doctorName = doctorName ?? this.doctorName
      ..departmentId = departmentId ?? this.departmentId
      ..departmentName = departmentName ?? this.departmentName
      ..text = text ?? this.text
      ..list = list ?? this.list
      ..shopLabelList = shopLabelList ?? this.shopLabelList
      ..acquisitionLabelList = acquisitionLabelList ?? this.acquisitionLabelList
      ..isDelete = isDelete ?? this.isDelete
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime;
  }
}

PatientListDataDataList $PatientListDataDataListFromJson(
    Map<String, dynamic> json) {
  final PatientListDataDataList patientListDataDataList = PatientListDataDataList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    patientListDataDataList.id = id;
  }
  final String? sickPersonId = jsonConvert.convert<String>(
      json['sickPersonId']);
  if (sickPersonId != null) {
    patientListDataDataList.sickPersonId = sickPersonId;
  }
  final String? templateItemId = jsonConvert.convert<String>(
      json['templateItemId']);
  if (templateItemId != null) {
    patientListDataDataList.templateItemId = templateItemId;
  }
  final int? doctorId = jsonConvert.convert<int>(json['doctorId']);
  if (doctorId != null) {
    patientListDataDataList.doctorId = doctorId;
  }
  final int? hospitalId = jsonConvert.convert<int>(json['hospitalId']);
  if (hospitalId != null) {
    patientListDataDataList.hospitalId = hospitalId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    patientListDataDataList.name = name;
  }
  final String? text = jsonConvert.convert<String>(json['text']);
  if (text != null) {
    patientListDataDataList.text = text;
  }
  final dynamic label = json['label'];
  if (label != null) {
    patientListDataDataList.label = label;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    patientListDataDataList.type = type;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    patientListDataDataList.status = status;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    patientListDataDataList.sort = sort;
  }
  return patientListDataDataList;
}

Map<String, dynamic> $PatientListDataDataListToJson(
    PatientListDataDataList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['sickPersonId'] = entity.sickPersonId;
  data['templateItemId'] = entity.templateItemId;
  data['doctorId'] = entity.doctorId;
  data['hospitalId'] = entity.hospitalId;
  data['name'] = entity.name;
  data['text'] = entity.text;
  data['label'] = entity.label;
  data['type'] = entity.type;
  data['status'] = entity.status;
  data['sort'] = entity.sort;
  return data;
}

extension PatientListDataDataListExtension on PatientListDataDataList {
  PatientListDataDataList copyWith({
    String? id,
    String? sickPersonId,
    String? templateItemId,
    int? doctorId,
    int? hospitalId,
    String? name,
    String? text,
    dynamic label,
    int? type,
    String? status,
    int? sort,
  }) {
    return PatientListDataDataList()
      ..id = id ?? this.id
      ..sickPersonId = sickPersonId ?? this.sickPersonId
      ..templateItemId = templateItemId ?? this.templateItemId
      ..doctorId = doctorId ?? this.doctorId
      ..hospitalId = hospitalId ?? this.hospitalId
      ..name = name ?? this.name
      ..text = text ?? this.text
      ..label = label ?? this.label
      ..type = type ?? this.type
      ..status = status ?? this.status
      ..sort = sort ?? this.sort;
  }
}